<?php

namespace App\Http\Resources\OpenShop\ShopLocation;

use App\Enums\Check\CheckEnum;
use App\Http\Resources\BaseResource;
use App\Models\OpenShop\InvestmentPromotion\OpenShopSignOrderPayHistoryModel;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;

class OrderPayHistoryResource extends BaseResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  Request  $request
     * @return array
     */
    public function toArray($request): array
    {
        return [
            'payNo'             => $this->payNo,
            'shouldPayPrice'    => $this->shouldPayPrice,
            'payPrice'          => $this->payPrice,
            'payStatus'         => $this->payStatus,
            'payStatusText'     => OpenShopSignOrderPayHistoryModel::STATUS_MAP[$this->payStatus] ?? '',
            'payChannel'        => $this->payChannel,
            'payChannelText'    => CheckEnum::PAY_CHANNEL_TEXT[$this->payChannel] ?? '',
            'payTime'           => formatDate($this->payTime),
            'type'              => $this->type,
            'desc'              => $this->subject,
            'subject'           => $this->subject,
            'proofImg'          => privateFilePath($this->proofImg),
            'createdAt'         => formatDate($this->createdAt->timestamp),
        ];
    }
}
